<template>
<div>
    <!-- 轮播图组件 -->
    <van-swipe :autoplay="3000">
      <van-swipe-item v-for="(image, index) in images" :key="index">
            <img v-lazy="image"  />
      </van-swipe-item>
    </van-swipe>
</div>
</template>
<script>
export default {
  props: ['id'],
  data () {
    return {
      images: [
      ]
    }
  },
  mounted () {

  },
  created () {
    this.getSwipePic(this.id)
  },
  methods: {
    async getSwipePic (id) {
      const { data: res } = await this.$http.get('api/getthumimages/' + id)
      console.log(res)
      for (let i = 0; i < res.message.length; i++) {
        const element = res.message[i].src
        this.images.push(element)
      }

    //   console.log(res.message)
    }
  }
}
</script>
<style lang="less" scoped>
.van-swipe img {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 220px;
  padding: 30px 60px;
  background-color: #fff;
  pointer-events: none;
}
</style>
